

package com.dog.basics.bean.vo.admin.sys;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * @author guonh
 * @date 2017年11月9日23:33:27
 */
@Data
@ApiModel(value = "菜单树")
@EqualsAndHashCode(callSuper = true)
public class MenuTree extends TreeNode implements Serializable {

    /**
     * 菜单图标
     */
    @ApiModelProperty(value = "菜单图标", dataType = "String")
    private String icon;

    /**
     * 菜单名称
     */
    @ApiModelProperty(value = "菜单名称", dataType = "String")
    private String name;

    private boolean spread = false;

    /**
     * 前端路由标识路径
     */
    @ApiModelProperty(value = "前端路由标识路径", dataType = "String")
    private String path;

    /**
     * 路由缓冲
     */
    @ApiModelProperty(value = "路由缓冲", dataType = "String")
    private String keepAlive;

    /**
     * 权限编码
     */
    @ApiModelProperty(value = "权限编码", dataType = "String")
    private String permission;

    /**
     * 菜单类型 （0菜单 1按钮）
     */
    @ApiModelProperty(value = "菜单类型,0:菜单 1:按钮", dataType = "String")
    private String type;

    /**
     * 菜单标签
     */
    @ApiModelProperty(value = "菜单标签", dataType = "String")
    private String label;

    /**
     * 排序值
     */
    @ApiModelProperty(value = "排序值", dataType = "Integer")
    private Integer sort;

    /**
     * 是否包含子节点
     *
     * @since 3.7
     */
    @ApiModelProperty(value = "是否包含子节点", dataType = "Boolean")
    private Boolean hasChildren;

    public MenuTree() {
    }

    public MenuTree(AdminMenuVO menuVo) {
        this.id = menuVo.getMenuId();
        this.parentId = menuVo.getParentId();
        this.icon = menuVo.getIcon();
        this.name = menuVo.getName();
        this.path = menuVo.getPath();
        this.type = menuVo.getType();
        this.permission = menuVo.getPermission();
        this.label = menuVo.getName();
        this.sort = menuVo.getSort();
        this.keepAlive = menuVo.getKeepAlive();
    }

}
